﻿var _site;
var _listID;

function ShowAdminListPopUp(listID) {
    _listID = listID;
    var ctx = SP.ClientContext.get_current();
    _site = ctx.get_site();
    ctx.load(_site);
    ctx.executeQueryAsync(OnQuerySucceed, OnQueryFailed);
}

function OnQuerySucceed() {
    var siteUrl = _site.get_url();
    var encodedListUrl = siteUrl + '/Lists/SurveyAdministrationList/AllItems.Aspx?FilterField1=SurveyListID&FilterValue1=' + _listID;
    SP.UI.ModalDialog.OpenPopUpPage(encodedListUrl, null, 800, 400)
}

function OnQueryFailed() {
    alert('Unexpected error');
}